package com.home.homepage.controller.headNav;

import com.eig.common.entity.homepageentity.headNav.TbHeadNav;
import com.eig.common.vo.Result;
import com.home.homepage.service.headNav.HeadService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author ：YQ袁（2446806940@qq.com）
 * @date ：Created in 2022/12/8 19:52
 * @description：
 * @modified By：
 * @version:
 */
@RestController
@RequestMapping("/home/head")
@Api(tags = "首页管理接口")
public class HeadController {
    @Autowired
    private HeadService headService;

    @PostMapping("/getAllHeadNav/{current}/{pageSize}")
    @ApiOperation(value = "分页查询" ,notes = "根据current ，pageSize分页")
    public Result getAllHeadNav(
            @PathVariable(required = true ) Integer current,
            @PathVariable(required = true) Integer pageSize,
            @RequestBody TbHeadNav tbHeadNav
    ){
        return headService.getAllHeadNav(current,pageSize,tbHeadNav);
    }


    @PostMapping("/deleteHeadNav")
    @ApiOperation(value = "删除接口")
    public Result deleteHeadNav(@RequestBody TbHeadNav tbHeadNav){
        return headService.deleteHeadNav(tbHeadNav);
    }
    @PostMapping("/changeStatus/{headId}/{isDiable}")
    @ApiOperation(value = "修改状态接口",notes = "根据headID修改isDiable")
    public Result changeStatus(
            @PathVariable String headId,
            @PathVariable String isDiable
    ){
        System.out.println( headId+"2222222222222222222222");
        System.out.println(isDiable+"1111111");
        return headService.changeStatus(headId,isDiable);
    }

    @PostMapping("/addHeadNav")
    @ApiOperation(value = "添加接口")
    public Result addHeadNav(@RequestBody TbHeadNav tbHeadNav){
        return headService.addHeadNav(tbHeadNav);
    }
}
